package com.elinkway.infinitemovies.utils;

import android.content.Context;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

import com.elinkway.infinitemovies.application.MoviesApplication;

/**
 * Author: liuxiaojiang(liuxiaojiang@lvideo.com)
 * Date: 2016-04-26
 * Time: 15:29
 * Description: 播放数据的工具类
 */
public class PlayDataUtil {
    public static String getNewSessionId() {
        String secretCode = TokenUtil.getCode(MoviesApplication.getInstance());
        String sessionId = System.currentTimeMillis() + secretCode;
        return MD5Utils.md5(sessionId);
    }

    public static String getSimOperatorInfo(){
        TelephonyManager telephonyManager = (TelephonyManager) MoviesApplication.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
        String operatorString = telephonyManager.getSimOperator();
        if(TextUtils.isEmpty(operatorString)){
            return "";
        }else{
            return operatorString;
        }
    }
}
